<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
	<meta http-equiv="Pragma" content="no-cache" />
	<meta http-equiv="Expires" content="0" />
	<meta http-equiv="Last-Modified" content="Thu, 12 Jan 2018 11:44:00 GMT+0800">
    <title>首页</title>
    <!--<script src="js/jquery-3.2.1.min.js"></script>-->
    <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
    <script src="./js/media.js?v=1.222"></script>
    <script type="text/javascript">
		document.documentElement.style.fontSize = document.documentElement.clientWidth / 375 * 100 + 'px';
    </script>
    <link rel="stylesheet" href="css/common.css">
    <link rel="stylesheet" href="css/index.css?v=1.12">
    <link rel="stylesheet" href="css/swiper.min.css">
    <script src="js/common.js"></script>
    <script src="js/swiper.min.js"></script>
    <script src='js/vue.js'></script>
    <!--<script src='js/vue-resource.min.js'></script>-->
    <script src="https://cdn.jsdelivr.net/npm/vue-resource@1.5.0"></script>
   <!-- <script src="js/public.js"></script>-->
    <!--<script src="http://pv.sohu.com/cityjson?ie=utf-8"></script>-->
    <style>
        .main-0 {
            display: none;
        }

        .active {
            display: block;
        }

        .swiper-container {
            width: 100%;
            height: 45vw;
        }

        .swiper-slide {
            text-align: center;
            font-size: 18px;
            background: #fff;

            /* Center slide text vertically */
            display: -webkit-box;
            display: -ms-flexbox;
            display: -webkit-flex;
            display: flex;
            -webkit-box-pack: center;
            -ms-flex-pack: center;
            -webkit-justify-content: center;
            justify-content: center;
            -webkit-box-align: center;
            -ms-flex-align: center;
            -webkit-align-items: center;
            align-items: center;
        }

        .spans2{
            background: url('img/热度 01@2x.png') no-repeat left;
            background-size: .1rem .13rem;
            color: #fff;
            /*position: absolute;*/
            top: .12rem;
            right: .12rem;
            padding-left: .14rem;
            color: red;
        }
        .spans{
            background: url('img/热度 02@2x.png') no-repeat left;
            background-size: .1rem .13rem;
            /*position: absolute;*/
            top: .12rem;
            right: .12rem;
            padding-left: .14rem;
        }


        .ems1{
            margin-left: .16rem;
            padding-left: .16rem;
            background: url('img/收藏 02@2x.png') no-repeat left;
            background-size: .14rem;
        }
        .ems2{
            margin-left: .16rem;
            padding-left: .16rem;
            background: url('img/收藏 01@2x.png') no-repeat left;
            background-size: .14rem;
            color: red;
        }
        .title_one{
        	display: flex;
        	justify-content: center;
        	align-items:center;
        	height: 0.4rem;
        	width: 100%;
        	padding-top: 0.08rem;
        }
        .title_one span{
        	width:0.18rem;
        	height: 0.03rem;
        	background: #000;
        	margin: 0 0.1rem;
        }
        .title_one p{
        	font-size:0.16rem;
        	
        }
        .index-main nav {
        	position: relative;
        }
        .index-main nav div{
    	    z-index: 3;
		    display: none;
		    width: 100%;
		    justify-content: space-around;
		    align-items: center;
		    position: absolute;
		    top: .36rem;
		    left: 0;
		    background: #fff;
		    box-shadow: #eee 1px 1px 1px 1px;
		    font-size: .14rem;
        }
        .filtrate p{
        	width: 100%;
        	box-sizing: border-box;
        	padding: 0 0.16rem;
        	height: 0.44rem;
        	line-height: 0.44rem;
        	display: block;
        	font-size: 0.14rem;
        	border-bottom: 0.01rem solid #DCDCDC;
        }
        .filtrate p.sel{
        	background: url(img/select_index.png) no-repeat 3.4rem center;
    		background-size: 0.19rem;
        }
    </style>
</head>

<body>
    <!-- <div class="top_all" style="width: 100%;height:2000px;position: fixed;z-index: 999999;background: #fff;top: 0;left: 0;right: 0;bottom:0;">
        本网页正在维护中！
    </div> -->
    <!--头部-->
    <div class="public-header flex" style="background:rgba(95,49,4,1);">
        <span class="public-header-left-search" style="background:url('img/搜索-搜索@2x.png') no-repeat left;background-size:contain;"
            onclick='window.location.href="page/search.html"'></span>
        <!-- <span class="public-header-left-back"></span> -->
        <span class="public-header-center">紫陶汇</span>
        <span class="public-header-right"></span>
    </div>
    <!--正文-->
    <div class="index-main bc-gray" >
        <nav class="flex">
            <a href="javascript:;" class="active">活动</a>
            <a href="javascript:;" @click='tab2Load()'>关注</a>
            <a href="javascript:;">专场拍</a>
            <!--<a href="javascript:;" @click='tab4Load()'>私人订制</a>-->
            <a href="javascript:;" @click='' style="background: url('../img/综合推荐 箭头 未选中@2x.png') no-repeat right;background-size: 0.12rem 0.07rem;">特价专场</a>
            <div class="filtrate">
            	<p class="sel" @click='tab5Load(1)'>起拍价正序</p>
	            <p @click='tab5Load(2)'>起拍价倒序</p>
	            <p @click='tab5Load(3)'>一口价正序</p>
	            <p @click='tab5Load(4)'>一口价倒序</p>
	            <p @click='tab5Load(5)'>时间正序</p>
	            <p @click='tab5Load(6)'>时间倒序</p>
            </div>
        </nav>
        <div class="main">
            <!--活动-->
            <div class="main-1 main-0 active" style="padding-bottom:15vw;">
                <!-- Swiper -->
                <div class="swiper-container">
                    <div class="swiper-wrapper">
                        <div class="swiper-slide" v-for="item in lunbo_img" @click='activity_fun(item)' v-bind:style="{ 'background-image': 'url(' + item.banner_img + ')','background-repeat':'no-repeat','background-size':'cover','background-position':'center center' }">
                            <!--<img :src="item.img" alt="" style="width:100%;height:100%" @click='link_buy(this)'>-->
                        </div>
                    </div>
                    <!-- Add Pagination -->
                    <div class="swiper-pagination"></div>
                </div>
                <div class="title_one">
                	<span></span>
                	<p>特价专区</p>
                	<span></span>
                </div>
                <img :src = "tejia" @click='tab5Load()'/>
                
                <div class="title_one">
                	<span></span>
                	<p>精品鉴赏</p>
                	<span></span>
                </div>
                <img :src="item.img" alt="loading" v-for='item in activity' @click='link_buy(this,true)'>
            </div>
            <!--关注-->
            <div class="main-2  main-0 " >
                <ul id="gz">
                    <!--     <li v-for='item in follow'>
                        <p class="main-2-1 flex" v-for='items in item'><span>{{items.store_name}}</span><em>已关注</em></p>
                        <img v-for='items in item' :src="items.store_image" class="user">
                        <div style="position:relative;" @click='link_buy(this)'>
                            <img v-for='items in item' :src="items.produce_head_image" class="product">
                            <p v-for='items in item' class="main-2-2">{{items.produce_title}}</p>
                        </div>
                        <p class="main-2-3" v-for='items in item'>{{items.produce_describe}}</p>
                        <p class="main-2-4 flex" v-for='items in item'>
                            <span v-bind:class="{ 'spans': trs, 'spans2': !trs }"  @click='add_good(this)'>{{items.produce_good_num}}</span>
                            <em  @click='add_Collection(this)'>{{items.produce_collect_num}}</em>
                            <i>{{items.produce_share_num}}</i>
                        </p>
                    </li>-->
                </ul>
            </div>
            <div class="main-3  main-0" style="padding-bottom: 12vw;">
                <ul>
                    <li v-for='item in zhuanchang' @click='link_buy(this,false)'>
                    	<div style="position: relative;">
                    		<img :src="item.produce_head_image.split(',')[0]" alt="">
                        	<p class="bt" style="bottom: 0;left: 0;right: 0;background-size:cover;">{{item.produce_title}}</p>
                    	</div>
                        <p class="p1">专场状态： <span>拍卖进行中</span></p>
                        <p class="p1">截拍时间： <em>{{item.time_0}}-{{item.time_1}}</em></p>
                    </li>
                </ul>
            </div>
            <div class="main-4 main-0">
                <ul>
                   <li class="flex" v-for='item in order' @click='link(this)'>
                        <img :src="item.store.store_image" alt="">
                        <div class="center">
                            <p class="p1"> {{item.store.store_name}}</p>
                            <p class="p2">
                                <font v-for='items in item.type'>/{{items.firstTypeDiscribe}}</font>
                            </p>
                        </div>
                        <span></span>
                    </li>
                </ul>
            </div>
            <div class="main-5 main-0" style="padding-bottom: 12vw;">
                <ul class="clearfix">
                    <li v-for='item in jinxuan' @click='link_buy(this,true)' v-bind:style="{ 'background-image': 'url(' + item['produce_head_image'].split(',')[0] + ')','background-repeat':'no-repeat','background-size':'100% 100%','background-position':'center center' }">
                        <!--<img :src="item['produce_head_image']" alt="" @click='link_buy(this)'>-->
                        
                        <div style="bottom:0;" >
                        	<p>{{item.produce_title}}</p>
                        	<span style="display: block;" class="clearfix">
                        		<p style="float: left;">一口价:<b style="font-weight: normal;color: red;" v-if = 'item.produce_money'>{{item.produce_money}}</b>
                        			<b style="font-weight: normal;color: #FFF;" v-else = 'item.produce_money'>无</b>
                        		</p>
                        		<p style="float: right;">起拍价:<b style="font-weight: normal;color: red;" v-if = "item.starting_price">{{item.starting_price}}</b>
                        			<b style="font-weight: normal;color: #FFF;" v-else = "item.starting_price">无</b>
                        		</p>
                        	</span>
                        	
                        </div>
                        <!--<div style="bottom: 0px;">{{item.produce_describe}}</div>-->
                        <!--<span style="position: absolute;right: 10px;top: 10px;" @click='add_good_0(this)'>{{item.produce_good_num}}</span>-->
                    </li>
                </ul>
            </div>
        </div>
    </div>
    <!--底部-->
    <div class="public-footer flex">
        <div class="button-1 active">
            <span></span>
            <p>首页</p>
        </div>
        <div class="button-2" onclick="javascript:window.location.href='fenlei/fenlei.html'">
            <span></span>
            <p>分类</p>
        </div>
        <div class="button-3" onclick="javascript:window.location.href='./page/Excellent-shop.html'">
            <span></span>
            <p>店铺</p>
        </div>
        <div class="button-4"   onclick="nextMy()">
            <span></span>
            <p>我的</p>
        </div>
    </div>
    <!--灰色浮层-->
    <div class="mask" style="background: rgba(50,50,50,0.5);display:none;z-index:2;"></div>
    <!--弹出框-->
    <div class="index-box" style="display:none;">
        <div class="top flex">
            <div class="left">
                <img src="img/二维码@2x.png" alt="">
                <p>二维码</p>
            </div>
            <div class="right">
                <img src="img/链接@2x.png" alt="">
                <p>发送链接</p>
            </div>
        </div>
        <div class="bottom">取消</div>
    </div>
    <script>
       
        	//alert(localStorage.p_id);
            $('.index-main nav a').click(function () {
                var index = $(this).index();
                if(index == 3){
                	index = 4;
                	//$(".filtrate").slideUp();
                	$(".filtrate").slideToggle(200);
                }else{
               		$(".filtrate").slideUp(200);
                }
                $(this).addClass('active').siblings().removeClass('active');
                $('.main-0').eq(index).addClass('active').siblings().removeClass('active');
            })
            $(".filtrate p").click(function(){
            	$(this).addClass('sel').siblings().removeClass('sel');
            	setTimeout(function(){
            		$(".filtrate").slideUp(200);
            	},300)
            });
            $.ajax({//进入首页以后，尝试获取店铺的storeid
				url: base_url + 'ZITAOHUI/user',
				data: {
					userId: sessionStorage.getItem("uid"),
					value: 1
				},
				success: function(data) {
					//alert(JSON.stringify(data));
					var storeid = data.extend.user.storeId;
					if(storeid != null && storeid != '' && storeid != undefined) {
						sessionStorage.setItem("s_id", storeid);
						var nextType = getQueryString("nextType");//跳转到其他页面的函数 
				        switch (nextType){
				        	case "mai_daishouhuo":window.location.replace("./page/Buyer-order.html?status=3");
				        		break;
				        	case "mai_daifahuo":
				        	//alert(sessionStorage.getItem("uid")+sessionStorage.getItem("s_id"));
				        	window.location.replace("./page/Seller-order.html?tab_num=1");
				        		break;
				        	case "mai_daifahuo2":window.location.replace("./page/Seller-order.html?tab_num=2");
				        		break;	
				        	case "mai_daifukuan":window.location.replace("./page/Buyer-order.html?status=1");
				        		break;	
				        	case "shangpin":p_id();
				        		break;	
				        }
				        function p_id(){
				        	var p_id = localStorage.p_id;
				        	//alert(p_id);
				        	window.location.replace("./page/buy-info-page.3.html?p_id="+p_id);
				        }
					}else{
					}
				}
			});
            
            
        
        function nextMy (){
            if(localStorage.getItem("mytype") == 1){
                window.location.href = "wode/Sellers-center.html";
            }else{
                window.location.href='wode/my-page.html';
            }
        }
    </script>
    <script>
        var urls = encodeURI("http://www.yunnantese.com");
        //alert(11111111222223333333333333311);
        $(function () {
            // 获得本机ip，存储在session里
            //window.sessionStorage.setItem('ip',returnCitySN["cip"]);//根据IP来判断用户的位置，然后保存
//             var weixin_code = getQueryString('code');
//             if(isNull(sessionStorage.getItem("openid"))){
//                 if(isNull(weixin_code)){
//                     window.location.href = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx338d962a035cfba2" + "&redirect_uri=" + urls + "&response_type=code&scope=snsapi_userinfo#wechat_redirect"
//                 }else{
//                     ////console.log("微信code="+weixin_code);
//                     $.ajax({
//                         url: base_url + 'ZITAOHUI/callBack',
//                         data: {
//                             code: weixin_code
//                         },
//                         success: function (data) {
//                             //console.log(data)
//                             u_id = data.extend.list.user_Id;
//                             sessionStorage.setItem('u_id', u_id);
//                             sessionStorage.setItem("uid",u_id);
//                             sessionStorage.setItem("openid",data.extend.list.openid);
////                               alert("code="+weixin_code);
////                               alert("uid="+u_id);
////                               alert("openid="+data.extend.list.openid);
//								$.ajax({
//									url: base_url + 'ZITAOHUI/user',
//									data:{
//										userId: sessionStorage.getItem("uid"),
//										value: 1
//									},
//									success:function(data){
//										var storeid = data.extend.user.storeId;
//										if(storeid!=null&&storeid!=''&&storeid!=undefined){
//								       		sessionStorage.setItem("s_id",storeid);
//										}
//									}
//								});
//                         },
//                         error: function (data) {
//                             //console.log(data)
//                             alert("登录信息过期,点击确认重新获取信息");
//                             window.location.href = "http://www.yunnantese.com";
//                         }
//                     })
//
//                 }
//             }

//             var u_id;
//             //console.log(weixin_code);
//             ! function () {
//                 $.ajax({
//                     url: base_url + 'ZITAOHUI/callBack',
//                     data: {
//                         code: weixin_code
//                     },
//                     success: function (data) {
//                         //console.log(data)
//                         u_id = data.extend.list.user_Id;
//                         window.sessionStorage.setItem('u_id', u_id)
//                     },
//                     error: function (data) {
//                         //console.log(data)
//
//                         //console.error(1)
//                     }
//                 })
//             }()

						
            var num = getQueryString('num');
            if (num == 4) {
                $('nav a').eq(3).addClass('active').siblings().removeClass('active');
                $('.main-0').eq(4).addClass('active').siblings().removeClass('active');
            }

            new Vue({
                el: 'body',
                data: {
                	lunbo_img:[],
                    slide_img: [],
                    activity: [],
                    follow: [],
                    jinxuan: [],
                    order: [],
                    zhuanchang: [],
                    trs:1,
                    uid:'',
                    tejia:'',
                },
                ready: function () {
                    //获取活动
                    var _self = this;
                    _self.uid = sessionStorage.getItem("uid");
                    this.$http.get(base_url + 'ZITAOHUI/firstPage/huodong').then(
                        function (data) {
                            //console.log(data);
                            let all_data_tab1 = data.data.extend.data;
                            // //console.log(all_data_tab1);
                            let alide_array = [];
                            let data_array = []
                            for (var i = 0; i < all_data_tab1.length; i++) {
                                let code = all_data_tab1[i].code;
                                if (code == true) {
                                    alide_array.push(all_data_tab1[i])
                                    // //console.log(code)
                                } else {
                                    data_array.push(all_data_tab1[i])
                                }
                            }

                            this.$set('slide_img', alide_array.slice(0, 3))
                            this.$set('activity', data_array);

                            setTimeout(function () {
/*                                var swiper = new Swiper('.swiper-container', {
                                    pagination: '.swiper-pagination',
                                    nextButton: '.swiper-button-next',
                                    prevButton: '.swiper-button-prev',
                                    paginationClickable: true,
                                    spaceBetween: 30,
                                    centeredSlides: true,
                                    autoplay: 2500,
                                    autoplayDisableOnInteraction: false
                                });*/
                                for (let i = 0; i < alide_array.length; i++) {
                                    if (alide_array[i].typ == 0) {
                                        $('#focus .hd ul li').eq(i).find('a').attr(
                                            'src', 'page/buy-info-page.4.html?pid+'+alide_array[i].produce_id);
                                    } else if (alide_array[i].typ == 1) {
                                        $('#focus .hd ul li').eq(i).find('a').attr(
                                            'src', 'page/buy-info-page.4.html?pid'+alide_array[i].produce_id);
                                    }
                                }
                            }, 0);
                        },
                        function () {

                        })

                    this.$http.get(base_url + 'ZITAOHUI/firstPage/special').then(
                        function (data) {
                            let all_data = data.data.extend.produce;
                            for (let i = 0; i < all_data.length; i++) {
                                let start = new Date(all_data[i].auction_time);
                                let end = new Date(all_data[i].auction_deadline);
                                all_data[i].time_0 = (start.getMonth()+1) + '.' + start.getDate() +
                                    ' ' + start.getHours() + ':' + start.getMinutes();
                                all_data[i].time_1 = (end.getMonth()+1) + '.' + end.getDate() + ' ' +
                                    end.getHours() + ':' + end.getMinutes();
                            }
                            this.$set('zhuanchang', all_data);
                        },
                        function () {

                        })
					this.$http.get(base_url + 'ZITAOHUI/firstPage/lunbo').then(
                        function (data) {
                            let lunbo = data.data.extend.data;
                            this.$set('lunbo_img', lunbo);
							setTimeout(function () {
                                var swiper = new Swiper('.swiper-container', {
                                    pagination: '.swiper-pagination',
                                    nextButton: '.swiper-button-next',
                                    prevButton: '.swiper-button-prev',
                                    paginationClickable: true,
                                    spaceBetween: 30,
                                    centeredSlides: true,
                                    autoplay: 2500,
                                    autoplayDisableOnInteraction: false,
                                    loop:true,
                                });
                                
                            }, 0);
                        },
                        function () {}
                    )

                    this.$http.get(base_url + 'ZITAOHUI/firstPage/jingxuan',{
                    	params: {
										sort_type:1
									}
                    }).then(
                        function (data) {
                            let all_data_tab12 = data.data.extend.data;
                            this.$set('jinxuan', all_data_tab12)
							//console.log(this.jinxuan);
                        },
                        function () {

                     })
                    
                    this.$http.get(base_url + 'ZITAOHUI/column/selectColumnList?type=1').then(
                        function (data) {
                            this.$set('tejia', data.data.extend.data["0"].img);
                        },
                        function () {

                     })
                },
                methods: {
                    tab2Load: function () {
                        var _self = this;
                        this.$http.get(base_url + 'ZITAOHUI/firstPage/guanzhu', {
                            params: {
                                uid: sessionStorage.getItem("uid")
                            }
                        }).then(
                            function (data) {

                                let all_data_tab12 = data.data.extend.data;

//                          this.$set('follow', all_data_tab12);
                            $("#gz").html('');
                             if(all_data_tab12.length == 0){
                                $("#gz").html('<div style="text-align: center;margin-top: 100px;"> '+"您还未关注过商品"+'</div>');
                             }else{
                                 $.each(all_data_tab12,function (k,v){
                                     $.each(v,function (ks,items){
                                         $("#gz").append('<li>'+'<p class="main-2-1 flex"><span>'+items.store_name+'</span><em>'+"已关注"+'</em></p>'+
                                             '<img class="user" src="'+items.store_image+'">' +
                                             '<div style="position:relative;" onclick="link_buy2(this)" type="'+items.typ+'"   data-id="'+items.store_id+'">'+
                                             '<img class="product" style="height:2.5rem;" src="'+items.produce_head_image.split(',')[0]+'">'+
                                             '<p class="main-2-2" style="width: 100%">'+items.produce_title+'</p>'+
                                             '</div>'+
                                             '<p class="main-2-4 flex">'+
                                             '<em class="ems1" onclick="add_Collection(this)"  pid="'+items.produce_id+'">'+items.produce_collect_num+'</em>'+
                                             '<i>'+items.produce_share_num+'</i>'+
                                             '</p>'+
                                             '</li>');
                                     })
                                 })
                             }


                            },
                            function () {

                            })
                    },
                    tab4Load: function () {
                        this.$http.get(base_url + 'ZITAOHUI/firstPage/order').then(
                            function (data) {
                            	//console.log("私人定制："+JSON.stringify(data));
                                let all_data_tab12 = data.data.extend.data;

                                this.$set('order', all_data_tab12)

                            },
                            function () {

                            })
                    },
                    tab5Load: function (index) {
                    	var this_ = this;
                    	index = index==undefined?1:index;
						$(".index-main nav a").eq(3).addClass('active').siblings().removeClass('active');
			            $('.main-0').eq(4).addClass('active').siblings().removeClass('active');
                        this.$http.get(base_url + 'ZITAOHUI/firstPage/jingxuan',{
                        	params: {
										sort_type:index
									}
                        }).then(
                            function (data) {
                                let all_data_tab12 = data.data.extend.data;
                                this.$set('jinxuan', all_data_tab12)
								//console.log(this_.jinxuan);
                            },
                            function () {

                            })
                    },
                    link: function (t) {
                        window.location.href = 'page/custom-made.html?storeId=' + t.item.store.store_id
                    },
                    link_buy: function (t,flag) {
                        //console.log(t.item);
                        if (t.item.typ == 1) {
                        	if(flag){
                        		window.location.href = 'page/buy-info-page.3.html?p_id=' + t.item.produce_id
                        	}else{
                        		window.location.href = 'page/buy-info-page.3.html?p_id=' + t.item.produce_id+"&auction_special=1";
                        	}
                        } else if (t.item.typ == 0) {
                            //window.location.href = 'page/buy-info-page.4.html?p_id=' + t.item.produce_id;
                        } else if (t.item[0].typ == 0) {
                            //window.location.href = 'page/buy-info-page.4.html?p_id=' + t.item[0].produce_id;
                        } else if (t.item[0].typ == 1) {
                            if(flag){
                        		window.location.href = 'page/buy-info-page.3.html?p_id=' + t.item.produce_id
                        	}else{
                        		window.location.href = 'page/buy-info-page.3.html?p_id=' + t.item.produce_id+"&auction_special=1";
                        	}
                        }
                    },
                    activity_fun:function(imgurl){//跳转到活动页面的函数
                    	var imgurlcenter = imgurl.active_img;
                        window.location.href = 'page/Activity.html?imgurl='+imgurlcenter;
                    },
                    add_good: function (t) {

                        var _self  = this;
                        this.$http.get(base_url + 'ZITAOHUI/goodNum', {
                            params: {
                                produceId: t.items.produce_id,
                                user_id: u_id
                            }
                        }).then(
                            function (data) {
                                // //console.log(data)
                                let sun = data.data.extend;
                                sun = sun.haha.list;
                                if (sun == 1) {
                                    t.items.produce_good_num += 1;
                                    _self.trs = 0;
                                } else if (sun == 2) {
                                    alert('网络不好，请稍后再试')
                                } else {
                                    alert('您已经对该商品点过赞啦')
                                }
                            }
                        )
                    },
                    add_good_0: function (t) {
                        this.$http.get(base_url + 'ZITAOHUI/goodNum', {
                            params: {
                                produceId: t.item.produce_id,
                                user_id: u_id
                            }
                        }).then(
                            function (data) {
                                // //console.log(data)
                                let sun = data.data.extend;
                                sun = sun.haha.list;
                                if (sun == 1) {
                                    t.item.produce_good_num += 1;

                                } else if (sun == 2) {
                                    alert('网络不好，请稍后再试')
                                } else {
                                    alert('您已经对该商品点过赞啦')
                                }
                            }
                        )
                    },
                    add_Collection: function (t) {
                        this.$http.get(base_url + 'ZITAOHUI/conllectionNum', {
                            params: {
                                produceId: t.items.produce_id,
                                user_id: u_id
                            }
                        }).then(
                            function (data) {
                                // //console.log(data)
                                let sun = data.data.extend;
                                sun = sun.list.conllection;
                                if (sun == 1) {
                                    t.items.produce_collect_num += 1;

                                } else if (sun == 2) {
                                    alert('网络不好，请稍后再试')
                                } else {
                                    alert('您已经对该商品点过收藏啦')
                                }
                            }
                        )
                    }

                }
            })
        })

        function add_good(obj){
            /**
             * 左侧第一个按钮
             * **/
            var pid = $(obj).attr("pid");
            var newurl  = "produceId="+pid+"&user_id="+localStorage.getItem("u_id");
            $.ajax({
                url:base_url + 'ZITAOHUI/goodNum?'+newurl,
                type:"get",
                dataType:"json",
                success:function (data){
                    let sun = data.extend;
                    sun = sun.haha.list;
                    if (sun == 1) {
                        $(obj).text((parseInt($(obj).text()))+1);
                        $(obj).attr("class","spans2");
                    } else if (sun == 2) {
                        alert('网络不好，请稍后再试')
                    } else {
                        alert('您已经对该商品点过赞啦')
                    }
                }
            })
        }

        function add_Collection(obj){
            /**
             * 左侧第二个按钮
             * **/
            var pid = $(obj).attr("pid");
            var newurl  = "produceId="+pid+"&user_id="+localStorage.getItem("u_id");
            $.ajax({
                url:base_url + 'ZITAOHUI/goodNum?'+newurl,
                type:"get",
                dataType:"json",
                success:function (data){
                    let sun = data.extend;
                    sun = sun.haha.list;
                    if (sun == 1) {
                        $(obj).text((parseInt($(obj).text()))+1);
                        $(obj).attr("class","ems2");
                    } else if (sun == 2) {
                        alert('网络不好，请稍后再试')
                    } else {
                        alert('您已经对该商品点过赞啦')
                    }
                }
            })
        }

        function link_buy2 (obj){
            var type = $(obj).attr("type");
            var id = $(obj).attr("data-id");
            window.location.href = 'page/Shop.html?s_id=' + id;
//          if (type == 0) {
//              window.location.href = 'page/buy-info-page.4.html?p_id=' + id;
//          } else if (type == 1) {
//              window.location.href = 'page/buy-info-page.3.html?p_id=' + id;
//          }
        }
    </script>

</body>

</html>